package com.yand.thinkingInJava.thinkingInJava21.ShareResource;

import java.util.concurrent.atomic.AtomicInteger;


/**
 * 最好还是依赖锁的实现
 */
public class AtomicEvenGenerator extends IntGenerator {

    private AtomicInteger i = new AtomicInteger(0);

    public int next(){
        return i.addAndGet(2);
    }

    public static void main(String [] args){
        EventChecker.test(new AtomicEvenGenerator());
    }

}
